import {http} from "@/utils/index.jsx";


export function getUserInfoAPI() {
    return http({
        method:'GET',
        url:'/user/userInfo'
    })
}

// 分页查询所有用户数据
export function getAllUserListAPI(cur,pageSize){
    return http({
        method:'GET',
        url:'/user/list',
        params:{
            cur:cur,
            pageSize:pageSize
        }
    })
}

// 查询所有用户数据条数
export function getAllUserCountAPI() {
    return http({
        method:'GET',
        url:'/user/userCount'
    })
}
// 根据id删除一条数据
export function deleteOneUserAPI(id) {
    return http({
        method:'DELETE',
        url:`/user/remove/${id}`
    })
}
// 根据id查询一条数据
export function getOneUserDetailByIdAPI(id) {
    return http({
        method:'GET',
        url:`/user/getInfo/${id}`
    })
}

// 新增一条数据
export function saveOneAPI(data) {
    return http({
        method:'POST',
        url:'/user/save',
        data
    })
}

// 修改一条数据
export function updateOneAPI(data){
    return http({
        method:'PUT',
        url:'/user/update',
        data
    })
}

//根据登录名或者真实姓名查询用户（用list，可能有1个或者多个）
export function getUserListByNameAPI(name,cur,pageSize) {
    return http({
        method:'GET',
        url:'/user/getByName',
        params:{
            name:name,
            cur:cur,
            pageSize:pageSize
        }
    })
}

// 根据登录名或者真实姓名查询用户数量
export function getUserCountByNameAPI(name) {
    return http({
        method:'GET',
        url:`/user/getByNameCount`,
        params:{
         name:name
        }
    })
}



// 根据时间段查询用户（用list）
export function getUserListByTimeAPI(startTime,endTime,cur,pageSize) {
    return http({
        method:'GET',
        url:'/user/getByBetweenTimes',
        params:{
            startTime,
            endTime,
            cur,
            pageSize
        }
    })
}

//根据时间段查询用户数量
export function getUserCountByTimeAPI(startTime,endTime){
    return http({
        method:'GET',
        url:'/user/getCountByBetweenTime',
        params:{
            startTime,endTime
        }
    })

}